package me.tenyks.studycase.activiti;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;

/**
 * @author 李仲允
 * @date 2022/4/18 15:31
 */
public class Demo {

    public static void main(String[] args) {
        // Create Activiti process engine
        ProcessEngine processEngine = ProcessEngineConfiguration
                .createStandaloneProcessEngineConfiguration()
                .buildProcessEngine();

        // Get Activiti services
        RepositoryService repositoryService = processEngine.getRepositoryService();
        RuntimeService runtimeService = processEngine.getRuntimeService();

        // Deploy the process definition
        repositoryService.createDeployment()
                .addClasspathResource("bpmn/FinancialReportProcess.bpmn20.xml")
                .deploy();

        // Start a process instance
        runtimeService.startProcessInstanceByKey("financialReport");

    }

}
